<?php
class controller_tools extends controller_base {
	/**
	 * 日历
	 */
	public function action_calendar() {
		
	}
	
	// ----------------------------------------------------------
	
	/**
	 * 联系人
	 */
	public function action_contact_import() {
		$model_contact = new model_contact();
		$count = $model_contact->import_all();
		
		//添加日志
		new model_logs('contact import '.$count);
		
		$this->message("成功导入 $count 条记录", './?m=tools&a=contact_list');
	}
	
	/**
	 * 联系人列表
	 */
	public function action_contact_list() {
		$model_contact = new model_contact();
		$res = $model_contact->find_all(1);
		
		$this->assign('res', $res);
		$this->assign('count', $model_contact->get_count());
	}
	
	/**
	 * 清空联系人
	 */
	public function action_contact_truncate() {
		$model_contact = new model_contact();
		$model_contact->truncate();
		
		//添加日志
		new model_logs('contact truncate');
		
		$this->message('清空完成', './?m=tools&a=contact_list');
	}
	
	// ----------------------------------------------------------
	
	public function action_fetion() {
		$res = '';
		
		if(!empty($_POST['content'])) {
			$model_fetion = new model_fetion();
			$res = $model_fetion->send($_POST['content'], $_POST['to']);
		}
				
		$this->assign('res', $res);
	}
}
?>